<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta name="author" content="Petar">

	<title>CURL tester</title>
	<script language="javascript" type="text/javascript" src="scripts/prototype.js"></script>
	<script language="javascript" type="text/javascript">
	//<!--
		function ajaxPost(){
			var url = 'curl.php';
			new Ajax.Request(url, {
		  	parameters: $('req_form').serialize(true),
				onSuccess: function(transport){
					eval('var response = ' + transport.responseText + ';');
                    $('response[body]').value = response['body'];
                    $('response[content_type]').value = response['content_type'];
                    $('response[http_code]').value = response['http_code'];
				}
		  });
		  return false;
		}
	//-->
	</script>
</head>

<body>
<h1>Request</h1>
<form method="post" name="req_form" id="req_form">

<label>WHQ URL:</label><br>
<input type="text" name="url" id="url" size="60" /><br>

<label>HTTP Method:</label><br>
<select name="method" id="method">
    <option value="POST">POST</option>
	<option value="GET">GET</option>
	<option value="PUT">PUT</option>
	<option value="DELETE">DELETE</option>
</select>
<br>

<label>Body:</label><br>
<textarea id="content" name="content" rows="5" cols="60"></textarea><br>

<label>Content type:</label><br>
<input type="text" name="content_type" id="content_type" size="20" /><br>

<input type="button" name="send" id="send" value="SEND" onclick="ajaxPost();" />
</form>
<h1>Response</h1>

<label>Body:</label><br>
<textarea id="response[body]" name="response[body]" rows="5" cols="60"></textarea><br>

<label>Content type:</label><br>
<input type="text" name="response[content_type]" id="response[content_type]" size="20" /><br>

<label>Http Code:</label><br>
<input type="text" name="response[http_code]" id="response[http_code]" size="20" /><br>

</body>
</html>